package com.ysd.modules.sys.controller;


import com.ysd.common.utils.R;
import com.ysd.modules.sys.entity.CourseEntity;
import com.ysd.modules.sys.entity.SolveTopicVO;
import com.ysd.modules.sys.service.OptionsRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author dapeng
 * @since 2021-07-15
 */
@RestController
@RequestMapping("/options/record")
@Api(description = "PC刷题相关接口")
public class OptionsRecordController {
    @Autowired
    private OptionsRecordService optionsRecordService;

    /**
     * 信息
     */
    @PostMapping("/getSolveTopicVOList")
    @ApiOperation("刷题数据汇总-多条件查询刷题信息(课程暂时没有加入条件)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "classId", value = "班级ID", paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "courseId", value = "课程ID", paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "start", value = "开始时间", paramType = "query", dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束时间", paramType = "query", dataType = "string"),
    })
    public R getSolveTopicVOList(Integer classId, Integer courseId, Date start, Date end) {
        List<SolveTopicVO> solveTopicVOList = optionsRecordService.getSolveTopicVOList(classId, courseId, start, end);
        return R.ok().put("solveTopicVOList", solveTopicVOList);
    }

    @PostMapping("/getChapterListWrong")
    @ApiOperation("刷题数据汇总-刷题数据分析(SQL暂时没有加入条件)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "courseId", value = "课程ID", paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "start", value = "开始时间", paramType = "query", dataType = "string"),
            @ApiImplicitParam(name = "end", value = "结束时间", paramType = "query", dataType = "string"),
    })
    public R getChapterListWrong( Integer courseId, Date start, Date end) {
        List<Map<String, Object>> mapList = optionsRecordService.getChapterListWrong(courseId, start, end);
        return R.ok().put("mapList", mapList);
    }
}

